#ifndef BIG_INT
#define BIG_INT

#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <cctype>

#include "vect.h"

class big_int
{
public:
	big_int();
	explicit big_int(long long num);
	big_int(const big_int& bigint);
	explicit big_int(const std::string& str);
	big_int& operator=(const big_int& bigint);
	void swap(big_int& bigint);
	big_int abs() const;
	big_int operator-() const;
	bool operator<(const big_int& bigint) const;
	bool operator>(const big_int& bigint) const;
	bool operator<=(const big_int& bigint) const;
	bool operator>=(const big_int& bigint) const;
	bool operator==(const big_int& bigint) const;
	bool operator!=(const big_int& bigint) const;
	big_int& operator+=(const big_int& bigint);
	big_int& operator-=(const big_int& bigint);
	big_int& operator*=(const big_int& bigint);
	big_int& operator/=(const big_int& bigint);
	big_int& operator%=(const big_int& bigint);
	big_int operator+(const big_int& bigint) const;
	big_int operator-(const big_int& bigint) const;
	big_int operator*(const big_int& bigint) const;
	big_int operator/(const big_int& bigint) const;
	big_int operator%(const big_int& bigint) const;
	friend std::istream& operator>>(std::istream &in, big_int &bigint);
	friend std::ostream& operator<<(std::ostream &out, const big_int &bigint);
private:  
	static const long long base = 1000000000;
	static const unsigned int digits = 9;
	int comp(const big_int& bigint) const;
	void normalize();
	void crop();
	long long quick_div(const big_int& bigint) const;
	std::pair<big_int, big_int> div_and_rem(const big_int& bigint) const;
	big_int& operator*=(long long num);
	big_int operator*(long long num) const;
	big_int& operator<<=(int offset);
	big_int& operator>>=(int offset);
	big_int operator<<(int offset) const;
	big_int operator>>(int offset) const;
	vect a_nums;
	int shift;
	bool versa;
};
big_int abs(const big_int& bigint);
#endif